package com.bbx.flink.demo.windowfuncation;


import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.windowing.assigners.TumblingProcessingTimeWindows;
import org.apache.flink.streaming.api.windowing.time.Time;

public class FoldFuncationDemo {

    public  static void  main(String [] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.socketTextStream("192.168.10.131",10003)
                .map((MapFunction<String ,Integer>) value ->Integer.parseInt(value))
                .windowAll(TumblingProcessingTimeWindows.of(Time.minutes(1)));

//                .fold(100, (FoldFunction<Integer,Integer>)(acc,in)->{
//                    return acc+in;
//                }).print();
//        env.execute();
    }
}
